Computing systems frequently involve multiple processes or sessions operating in parallel. Often, one or more sessions require access to the same items of stored data. Competition between different sessions for the same stored data can result in collisions between the sessions and also can result in data errors and inconsistencies if not managed properly.
One solution to control data access by multiple sessions is to use cooperative task switching to only allow one active session at any time. Unfortunately, cooperative task switching using a single active session reduces processing speed and performance, especially on multiprocessor machines.
Another solution is to serialize data access by locking each data access session using a reader/writer lock. That is, when a first session accesses data, it causes a reader/writer lock to be imposed on the data to prevent another session from accessing the data during the time that the first session is accessing the data. Unfortunately, such a solution imposes processing overhead and can reduce system efficiency. For example, systems that use reader/writer locks require every session, including the session owning an item of data (the “data owning session”), to create a lock during access. This can result in significant overhead in situations where the data owning session frequently accesses the data, and can be particularly problematic where the data owning session frequently accesses the data but other sessions rarely access the data.
Accordingly, improved techniques for accessing session data are needed.